Completed
Push — master ( 03001f...fdb517 )
by Elbert
01:08
created

exports.run   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 13
rs 9.4285

1 Function

Rating   Name   Duplication   Size   Complexity  
A 0 3 1
1
'use strict';
2
3
const
4
	path      = require('path'),
5
	spawn     = require('child_process').spawn,
6
	phantomjs = require('phantomjs-prebuilt');
7
8
exports.run = function(args, callback) {
9
	args.unshift.apply(args, [path.join(__dirname, 'driver.js'), '--web-security=false', '--load-images=false', '--ignore-ssl-errors=yes', '--ssl-protocol=any']);
10
11
	var driver = phantomjs.exec.apply(this, args);
12
13
	driver.stdout.on('data', (data) => {
14
		callback(`${data}`, null);
15
	});
16
17
	driver.stderr.on('data', (data) => {
18
		callback(null, `${data}`);
19
	});
20
}
21
22
if ( !module.parent ) {
23
	exports.run(process.argv.slice(2), function(stdout, stderr) {
24
		if ( stdout ) {
25
			process.stdout.write(stdout);
26
		}
27
28
		if ( stderr ) {
29
			process.stderr.write(stderr);
30
		}
31
	});
32
}
33